package demo;
//懒汉模式
class LazyTon{
    private static  LazyTon instance= null;

    public static  LazyTon getInstance(){
        Object locker = new Object();
        //防止无缘无故加锁对程序带来消耗
        if (instance == null){
            //创建
            synchronized (locker) {
                //判断线程是否存在
                if (instance == null){
                    instance = new LazyTon();
                }
            }
        }
        return  instance;
    }
    private  LazyTon(){

    }
}
public class Test10 {

}
